#if !defined(ximera_assert_hpp)
#define ximera_assert_hpp

// -----------------------------------------------------------

#include <ximera/config.hpp>

#define XIMERA_STRINGIZE(x) #x
#define XIMERA_WIDEN(quote) L ## quote

//! Throws a ximera::Exception if expr evaluates to false
//! \param expr A boolean expression
#define XIMERA_CHECK_DEF(expr) XIMERA_CHECK(expr, XIMERA_THROW(ximera::Exception, L"Check failed: " XIMERA_WIDEN(#expr)))

//! Calls thrower if expr evaluates to false
//! \param expr A boolean expression
//! \param thrower The statement that will be executed if expr is false
#define XIMERA_CHECK(expr, thrower) \
    if (!(expr)) \
        thrower;

#if !defined(XIMERA_NO_ASSERT)
    //! Evaluates to XIMERA_CHECK_DEF(expr) if current configuration is not XIMERA_RELEASE
    //! \sa XIMERA_CHECK_DEF
    //! \param expr A boolean expression
    #define XIMERA_ASSERT_DEF(expr) XIMERA_CHECK_DEF(expr)

    //! Evaluates to XIMERA_CHECK(expr, thrower) if current configuration is not XIMERA_RELEASE
    //! \sa XIMERA_CHECK
    //! \param expr A boolean expression
    //! \param thrower The statement that will be executed if expr is false
    #define XIMERA_ASSERT(expr, thrower) XIMERA_CHECK(expr, thrower)

#else
    #define XIMERA_ASSERT_DEF(expr)
    #define XIMERA_ASSERT(expr, thrower)
#endif

// -----------------------------------------------------------

#endif